<?php
require_once("rpcl/rpcl.inc.php");
require_once("soap_sis_common.php");
require_once("soap_sis_common_laporan_keuangan.php");
//Includes
use_unit("webservices.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

function LAPORAN_SPP($connection_string){
  mysql_connect($connection_string[server_host], $connection_string[server_username], $connection_string[server_password]);
  mysql_select_db($connection_string[server_database]) or die(mysql_error());

  $sql    =   "
  SELECT      TABEL_SISWA.SISWA_KODE,
              TABEL_SISWA.SISWA_NAMA_AWAL,
              TABEL_SISWA.SISWA_NAMA_TENGAH,
              TABEL_SISWA.SISWA_NAMA_AKHIR,
              TABEL_SISWA.SISWA_KELAS,
              TABEL_SISWA_SPP.ID,
              TABEL_SISWA_SPP.SPP_TGL,
              TABEL_SISWA_SPP.SPP_NILAI,
              TABEL_SISWA_SPP.SPP_KETERANGAN
  FROM        TABEL_SISWA
  INNER JOIN  TABEL_SISWA_SPP
  ON          TABEL_SISWA.ID = TABEL_SISWA_SPP.SISWA_ID";

  $result = mysql_query($sql);

  $numrows = mysql_num_rows($result);
  $laporanlist = array();
  for($x = 0; $x < $numrows; $x++){
    $laporanlist[] = mysql_fetch_array($result);
    }

  mysql_close();
  return array('Berhasil', $laporanlist);

  }

function LAPORAN_UANGPEMBANGUNAN($connection_string){
  mysql_connect($connection_string[server_host], $connection_string[server_username], $connection_string[server_password]);
  mysql_select_db($connection_string[server_database]) or die(mysql_error());

  $sql    =   "
	SELECT      TABEL_SISWA.SISWA_KODE,
              TABEL_SISWA.SISWA_NAMA_AWAL,
              TABEL_SISWA.SISWA_NAMA_TENGAH,
              TABEL_SISWA.SISWA_NAMA_AKHIR,
              TABEL_SISWA.SISWA_KELAS,
              TABEL_SISWA_UANGPEMBANGUNAN.ID,
              TABEL_SISWA_UANGPEMBANGUNAN.UANGPEMBANGUNAN_TGL,
              TABEL_SISWA_UANGPEMBANGUNAN.UANGPEMBANGUNAN_NILAI,
              TABEL_SISWA_UANGPEMBANGUNAN.UANGPEMBANGUNAN_KETERANGAN
  FROM        TABEL_SISWA
  INNER JOIN  TABEL_SISWA_UANGPEMBANGUNAN
  ON          TABEL_SISWA.ID = TABEL_SISWA_UANGPEMBANGUNAN.SISWA_ID";

  $result = mysql_query($sql);

  $numrows = mysql_num_rows($result);
  $laporanlist = array();
  for($x = 0; $x < $numrows; $x++){
    $laporanlist[] = mysql_fetch_array($result);
    }

  mysql_close();
  return array('Berhasil', $laporanlist);

  }

function LAPORAN_BEASISWA($connection_string){
  mysql_connect($connection_string[server_host], $connection_string[server_username], $connection_string[server_password]);
  mysql_select_db($connection_string[server_database]) or die(mysql_error());

  $sql    =   "
	SELECT      TABEL_SISWA.SISWA_KODE,
              TABEL_SISWA.SISWA_NAMA_AWAL,
              TABEL_SISWA.SISWA_NAMA_TENGAH,
              TABEL_SISWA.SISWA_NAMA_AKHIR,
              TABEL_SISWA.SISWA_KELAS,
              TABEL_SISWA_BEASISWA.ID,
              TABEL_SISWA_BEASISWA.BEASISWA_TGL,
              TABEL_SISWA_BEASISWA.BEASISWA_NILAI,
              TABEL_SISWA_BEASISWA.BEASISWA_KETERANGAN
  FROM        TABEL_SISWA
  INNER JOIN  TABEL_SISWA_BEASISWA
  ON          TABEL_SISWA.ID = TABEL_SISWA_BEASISWA.SISWA_ID";

  $result = mysql_query($sql);

  $numrows = mysql_num_rows($result);
  $laporanlist = array();
  for($x = 0; $x < $numrows; $x++){
    $laporanlist[] = mysql_fetch_array($result);
    }

  mysql_close();
  return array('Berhasil', $laporanlist);

  }

function LAPORAN_PENERIMAAN($connection_string){
  mysql_connect($connection_string[server_host], $connection_string[server_username], $connection_string[server_password]);
  mysql_select_db($connection_string[server_database]) or die(mysql_error());

  $sql    =   "
	SELECT      TABEL_USER.USER_NAME,
              TABEL_USER.USER_NAMA_AWAL,
              TABEL_USER.USER_NAMA_TENGAH,
              TABEL_USER.USER_NAMA_AKHIR,
              TABEL_USER.USER_OTORISASI,
              TABEL_JURNAL_PENERIMAAN.ID,
              TABEL_JURNAL_PENERIMAAN.PENERIMAAN_JENIS,
              TABEL_JURNAL_PENERIMAAN.PENERIMAAN_TGL,
              TABEL_JURNAL_PENERIMAAN.PENERIMAAN_NILAI,
              TABEL_JURNAL_PENERIMAAN.PENERIMAAN_KETERANGAN
  FROM        TABEL_USER
  INNER JOIN  TABEL_JURNAL_PENERIMAAN
  ON          TABEL_USER.ID = TABEL_JURNAL_PENERIMAAN.USER_ID";

  $result = mysql_query($sql);

  $numrows = mysql_num_rows($result);
  $laporanlist = array();
  for($x = 0; $x < $numrows; $x++){
    $laporanlist[] = mysql_fetch_array($result);
    }

  mysql_close();
  return array('Berhasil', $laporanlist);

  }

function LAPORAN_PENGELUARAN($connection_string){
  mysql_connect($connection_string[server_host], $connection_string[server_username], $connection_string[server_password]);
  mysql_select_db($connection_string[server_database]) or die(mysql_error());

  $sql    =   "
	SELECT      TABEL_USER.USER_NAME,
              TABEL_USER.USER_NAMA_AWAL,
              TABEL_USER.USER_NAMA_TENGAH,
              TABEL_USER.USER_NAMA_AKHIR,
              TABEL_USER.USER_OTORISASI,
              TABEL_JURNAL_PENGELUARAN.ID,
              TABEL_JURNAL_PENGELUARAN.PENGELUARAN_JENIS,
              TABEL_JURNAL_PENGELUARAN.PENGELUARAN_TGL,
              TABEL_JURNAL_PENGELUARAN.PENGELUARAN_NILAI,
              TABEL_JURNAL_PENGELUARAN.PENGELUARAN_KETERANGAN
  FROM        TABEL_USER
  INNER JOIN  TABEL_JURNAL_PENGELUARAN
  ON          TABEL_USER.ID = TABEL_JURNAL_PENGELUARAN.USER_ID";

  $result = mysql_query($sql);

  $numrows = mysql_num_rows($result);
  $laporanlist = array();
  for($x = 0; $x < $numrows; $x++){
    $laporanlist[] = mysql_fetch_array($result);
    }

  mysql_close();
  return array('Berhasil', $laporanlist);

  }

//Class definition
class DataModule1 extends DataModule
{
    public $SIS_LAPORAN_KEUANGAN = null;
    function SIS_LAPORAN_KEUANGANAddComplexTypes($sender, $params)
    {
    RegisterCommonComplexType_InfoServer($this->SIS_LAPORAN_KEUANGAN);
    RegisterCommonComplexType_Laporan_SPP($this->SIS_LAPORAN_KEUANGAN);
    RegisterCommonComplexType_Laporan_UangPembangunan($this->SIS_LAPORAN_KEUANGAN);
    RegisterCommonComplexType_Laporan_BeaSiswa($this->SIS_LAPORAN_KEUANGAN);
    RegisterCommonComplexType_Laporan_Penerimaan($this->SIS_LAPORAN_KEUANGAN);
    RegisterCommonComplexType_Laporan_Pengeluaran($this->SIS_LAPORAN_KEUANGAN);
    }
    function SIS_LAPORAN_KEUANGANRegisterServices($sender, $params)
    {

    $this->SIS_LAPORAN_KEUANGAN->register
      (
      "LAPORAN_SPP",
      array
        (
        'connection_string'=>'tns:TInfoServer'
        ),
      array
        (
        'return'=>'xsd:string',
        'laporanlist'=>'tns:TLaporanSPP'
        )
      );

    $this->SIS_LAPORAN_KEUANGAN->register
      (
      "LAPORAN_UANGPEMBANGUNAN",
      array
        (
        'connection_string'=>'tns:TInfoServer'
        ),
      array
        (
        'return'=>'xsd:string',
        'laporanlist'=>'tns:TLaporanUangPembangunan'
        )
      );

    $this->SIS_LAPORAN_KEUANGAN->register
      (
      "LAPORAN_BEASISWA",
      array
        (
        'connection_string'=>'tns:TInfoServer'
        ),
      array
        (
        'return'=>'xsd:string',
        'laporanlist'=>'tns:TLaporanBeaSiswa'
        )
      );

    $this->SIS_LAPORAN_KEUANGAN->register
      (
      "LAPORAN_PENERIMAAN",
      array
        (
        'connection_string'=>'tns:TInfoServer'
        ),
      array
        (
        'return'=>'xsd:string',
        'laporanlist'=>'tns:TLaporanPenerimaan'
        )
      );

    $this->SIS_LAPORAN_KEUANGAN->register
      (
      "LAPORAN_PENGELUARAN",
      array
        (
        'connection_string'=>'tns:TInfoServer'
        ),
      array
        (
        'return'=>'xsd:string',
        'laporanlist'=>'tns:TLaporanPengeluaran'
        )
      );

    }
}

global $application;

global $DataModule1;

//Creates the form
$DataModule1=new DataModule1($application);

//Read from resource file
$DataModule1->loadResource(__FILE__);

?>